//
//  GridViewItemMenuBook.m
//  X-Touch2
//
//  Created by shengchao yang on 12-3-20.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "GridViewItemMenuBook.h"
#import "Common.h"
#import "FileManager.h"

@implementation GridViewItemMenuBook
-(id) initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        imageBkg.image = [FileManager getImage:@"plubook_bkg.png" type:3 withRect:imageBkg.frame];
        [imageRecommend removeFromSuperview];//菜本图片不需要推荐标志
    }
    return self;
}

//重新调整UI控件的frame
- (void)drawRect:(CGRect)rect{
    [imageBkg setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [imageView setFrame:CGRectMake(10, 10, self.frame.size.width-20, self.frame.size.height-60)];
    [labelName setFrame:CGRectMake(10, self.frame.size.height-40, self.frame.size.width-20, 25)];
    
    [imageView setImage:[FileManager getImage:pluBook.pbImage type:1 withRect:imageView.bounds]];
}
//向UI控件里填充数据
-(void) setData:(id)data{
    pluBook = (PluBook *)data;
    [imageView setImage:[FileManager getImage:pluBook.pbImage type:1 withRect:imageView.bounds]];
    [labelName setText:JsonField(pluBook.pbDescripts)];
}
-(void) dealloc{
    [super dealloc];
}
@end
